<?php
require_once 'modules/content/models/Content.php';
require_once 'modules/content/models/ContentCategory.php';
require_once 'modules/language/models/Lang.php';

class front_home_featuredSticker extends Nine_Sticker
{
	public function run()
	{
		$objContent = new Models_Content();
        $objLang    = new Models_Lang();
        $objCat     = new Models_ContentCategory();
        
        $condition = array();
        $condition['content_category_gid'] = 21;
        $allContent = $objContent->setAllLanguages(true)->getAllContent($condition);
        
        $defaultImage = current($allContent);
		if(null != @$defaultImage['images']) {
            		$defaultImage['main_image'] = explode('||', trim($defaultImage['images'],'|| '));
            		
            		$flag = 0;
            		$class ="";
        			foreach ($defaultImage['main_image'] as &$item){
		            		if(null != $item) {
		            		if($flag == 0){$class = "cubeRandom";}
		            		if($flag == 1){$class = "block";}
		            		if($flag == 2){$class = "cubeStop";}
		            		if($flag == 3){$class = "cubeHide";$flag = 0;}
	            			$tmp = @explode(":", trim($item,': '));
	            			$item = array(
				            			'path' => Nine_Function::getThumbImage(@$tmp[0], 695, 365,null,true),
				            			'title' => @$tmp[1],
	            						'class' => $class
				            			);
	            		}
	            		$flag++;
        			}
        			unset($item);
        			
            	}
//            	echo "<pre>";print_r($defaultImage);die;
        $this->view->danhmuc = $allContent;
        $this->view->image = $defaultImage;
        
        $condition = array();
        $condition['content_category_gid'] = 37;
        $allContent = $objContent->setAllLanguages(true)->getAllContent($condition);
        
        foreach ($allContent as &$item){
        	$item['url'] = Nine_Route::_("content/index/line/id/".$item['content_gid'],array('alias' => $item['alias']));
        }
        unset($item);
		$this->view->allMenu = $allContent;
                                                  
	}
}